<% label_title = Alchemy.t("Create #{resource_name}", default: Alchemy.t('Create')) %>

<% content_for :toolbar do %>
  <div class="toolbar_buttons">
    <%= render Alchemy::Admin::ToolbarButton.new(
      icon: :plus,
      label: label_title,
      url: new_resource_path,
      title: label_title,
      hotkey: 'alt+n',
      tooltip_placement: "top-start",
      dialog_options: {
        title: label_title,
        size: "430x415"
      },
      if_permitted_to: [:create, Alchemy::Site]
    ) if @sites.any? %>
  </div>
  <%= render 'alchemy/admin/partials/search_form' %>
<% end %>

<div id="archive_all" class="resources-table-wrapper">
  <% if @sites.any? %>
    <%= render 'alchemy/admin/resources/table_header' %>
    <%= render 'alchemy/admin/resources/resource_table', icon: "global" %>
  <% elsif search_filter_params[:q].present? %>
    <%= render_message { Alchemy.t('Nothing found') } %>
  <% else %>
    <div class="panel no-resource-found">
      <%= render_message do %>
        <%== Alchemy.t('alchemy/site', scope: :no_resource_found) %>
      <% end %>
      <%= render 'form', site: Alchemy::Site.new(
          name: Alchemy.config.default_site.name,
          host: Alchemy.config.default_site.host,
          public: true
        ) %>
    </div>
  <% end %>
</div>
